package Utils

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/widget"
)

// ToolbarAction is push button style of ToolbarItem
type ToolbarActionOnlyLabel struct {
	Label string
	OnActivated func()
}
// NewButtonWithIcon creates a new button widget with the specified label, themed icon and tap handler
func NewButtonWithoutIcon(label string, tapped func()) *widget.Button {
	button := &widget.Button{
		Text:     label,
		Icon:     nil,
		OnTapped: tapped,
	}

	button.ExtendBaseWidget(button)
	return button
}
// ToolbarObject gets a button to render this ToolbarAction
func (t *ToolbarActionOnlyLabel) ToolbarObject() fyne.CanvasObject {
	button := NewButtonWithoutIcon(t.Label, t.OnActivated)
	button.Importance = widget.LowImportance

	return button
}
// NewToolbarAction returns a new push button style ToolbarItem
func NewToolbarActionOnlyLable(label string, onActivated func()) widget.ToolbarItem {
	return &ToolbarActionOnlyLabel{label, onActivated}
}